execute 'source' fnamemodify(expand('<sfile>'), ':h').'/module-clap.vim'


function! s:load_clap() 
	nnoremap <silent> <Leader>tc :<C-u>Clap colors<CR>
  nnoremap <silent> <Leader>fa :<C-u>Clap grep<CR>
  nnoremap <silent> <Leader>ft :<C-u>BTags<CR>
  nnoremap <silent> <C-x><C-f> :<C-u>Clap filer<CR>
  nnoremap <silent> <Leader>ff :<C-u>Clap files ++finder=rg --ignore --hidden --files<cr>
  nnoremap <silent> <Leader>fg :<C-u>Clap gfiles<CR>
  " if !exists("g:use_plugin_telescope")
  "nnoremap <silent> <Leader>fw :<C-u>Clap grep ++query=<cword><cr>
  " endif
  nnoremap <silent> <Leader>hh :<C-u>History<CR>
  nnoremap <silent> <Leader>fW :<C-u>Clap windows<CR>
  nnoremap <silent> <Leader>fl :<C-u>Clap blines<CR>
  nnoremap <silent> <Leader>fu :<C-u>Clap git_diff_files<CR>
  nnoremap <silent> <Leader>oc :<C-u>Clap personalconf<CR>
  nnoremap <silent> <Leader>gs :<C-u>Clap git_diff_files <CR>
" Find symbol of current document

if exists("g:use_coc")
  let g:which_key_map.f.c = 'CocList commands'
  nnoremap <silent> <space>fc  :<C-u>CocList commands<cr>
  nnoremap <silent> <space>mm  :<C-u>CocList mru<cr>
endif
endfunction


command! -nargs=+ -complete=custom,s:GrepArgs Rg exe 'CocList grep '.<q-args>
function! s:GrepArgs(...)
    let list = ['-S', '-smartcase', '-i', '-ignorecase', '-w', '-word',
            \ '-e', '-regex', '-u', '-skip-vcs-ignores', '-t', '-extension']
      return join(list, "\n")
endfunction

function! s:load_coclists() 
  nnoremap <silent> <Leader>fw :exe 'CocList -I --input='.expand('<cword>').' grep'<CR>
endfunction

if !has('nvim-0.5')
  call s:load_coclists()
  call s:load_clap()
endif

let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
